home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-11 | 11.7 KB | 561 lines | [TEXT/MPS ] |
- ;
- ; File: TextServices.a
- ;
- ; Copyright: © 1984-1994 by Apple Computer, Inc.
- ; All rights reserved.
- ;
- ; Version: Universal Interfaces 2.0a3 ETO #16, MPW prerelease. Friday, November 11, 1994.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
-
- IF &TYPE('__TEXTSERVICES__') = 'UNDEFINED' THEN
- __TEXTSERVICES__ SET 1
-
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- ; include 'ConditionalMacros.a' ;
-
- IF &TYPE('__EVENTS__') = 'UNDEFINED' THEN
- include 'Events.a'
- ENDIF
- ; include 'Quickdraw.a' ;
- ; include 'MixedMode.a' ;
- ; include 'QuickdrawText.a' ;
- ; include 'OSUtils.a' ;
- ; include 'Memory.a' ;
-
- IF &TYPE('__MENUS__') = 'UNDEFINED' THEN
- include 'Menus.a'
- ENDIF
-
- IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
- include 'AppleEvents.a'
- ENDIF
- ; include 'Errors.a' ;
- ; include 'EPPC.a' ;
- ; include 'PPCToolbox.a' ;
- ; include 'AppleTalk.a' ;
- ; include 'Processes.a' ;
- ; include 'Files.a' ;
- ; include 'Notification.a' ;
-
- IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
- include 'Components.a'
- ENDIF
-
- kTSMVersion EQU $200 ; Version of the Text Services Manager is 2.0
- kTextService EQU 'tsvc' ; component type for the component description
- kInputMethodService EQU 'inpm' ; component subtype for the component description
- ; Component Flags in ComponentDescription
- bTakeActiveEvent EQU 15 ; bit set if the component takes active event
- bHandleAERecording EQU 16 ; bit set if the component takes care of recording Apple Events <new in vers2.0>
- bScriptMask EQU $00007F00 ; bit 8 - 14
- bLanguageMask EQU $000000FF ; bit 0 - 7
- bScriptLanguageMask EQU bScriptMask + bLanguageMask ; bit 0 - 14
-
- ; Hilite styles
- kCaretPosition EQU 1 ; specify caret position
- kRawText EQU 2 ; specify range of raw text
- kSelectedRawText EQU 3 ; specify range of selected raw text
- kConvertedText EQU 4 ; specify range of converted text
- kSelectedConvertedText EQU 5 ; specify range of selected converted text
-
- ; Apple Event constants
- ; Event class
- kTextServiceClass EQU kTextService
- ; event ID
- kUpdateActiveInputArea EQU 'updt' ; update the active Inline area
- kPos2Offset EQU 'p2st' ; converting global coordinates to char position
- kOffset2Pos EQU 'st2p' ; converting char position to global coordinates
- kShowHideInputWindow EQU 'shiw' ; show or hide the input window
- ; Event keywords
- keyAETSMDocumentRefcon EQU 'refc' ; TSM document refcon, typeLongInteger
- ; Note: keyAETSMScriptTag, keyAERequestedType, keyAETSMTextFont, keyAETextPointSize
- ; typeAEText, typeIntlWritingCode, typeQDPoint, and keyAEAngle have been moved to
- ; AERegistry.h
- keyAEServerInstance EQU 'srvi' ; component instance
- keyAETheData EQU 'kdat' ; typeText
- keyAEFixLength EQU 'fixl' ; fix len ??
- keyAEHiliteRange EQU 'hrng' ; hilite range array
- keyAEUpdateRange EQU 'udng' ; update range array
- keyAEClauseOffsets EQU 'clau' ; Clause Offsets array
- keyAECurrentPoint EQU 'cpos' ; current point
- keyAEDragging EQU 'bool' ; dragging falg
- keyAEOffset EQU 'ofst' ; offset
- keyAERegionClass EQU 'rgnc' ; region class
- keyAEPoint EQU 'gpos' ; current point
- keyAEBufferSize EQU 'buff' ; buffer size to get the text
- keyAEMoveView EQU 'mvvw' ; move view flag
- keyAELength EQU 'leng' ; length
- keyAENextBody EQU 'nxbd' ; next or previous body
- ; optional keywords for Offset2Pos (Info about the active input area)
- keyAETextLineHeight EQU 'ktlh' ; typeShortInteger
- keyAETextLineAscent EQU 'ktas' ; typeShortInteger
- ; optional keywords for Pos2Offset
- keyAELeftSide EQU 'klef' ; type Boolean
- ; optional keywords for kShowHideInputWindow
- keyAEShowHideInputWindow EQU 'shiw' ; type Boolean
- ; for PinRange
- keyAEPinRange EQU 'pnrg'
- ; Desc type ...
- typeComponentInstance EQU 'cmpi' ; server instance
- typeTextRangeArray EQU 'tray' ; text range array
- typeOffsetArray EQU 'ofay' ; offset array
- typeText EQU 'TEXT' ; Plain text
- typeTextRange EQU 'txrn'
-
- ; Desc type constants
- kTSMOutsideOfBody EQU 1
- kTSMInsideOfBody EQU 2
- kTSMInsideOfActiveInputArea EQU 3
-
- kNextBody EQU 1
- kPreviousBody EQU 2
-
- ; typeTextRange 'txrn'
- TextRange RECORD 0
- fStart ds.l 1
- fEnd ds.l 1
- fHiliteStyle ds.w 1
- sizeof EQU 10
- ENDR
-
- ; typeTextRangeArray 'txra'
- TextRangeArray RECORD 0
- fNumOfRanges ds.w 1 ; specify the size of the fRange array
- fRange ds TextRange ; when fNumOfRanges > 1, the size of this array has to be calculated
- sizeof EQU 12
- ENDR
-
- ; typeOffsetArray 'offa'
- OffsetArray RECORD 0
- fNumOfOffsets ds.w 1 ; specify the size of the fOffset array
- fOffset ds.l 1 ; when fNumOfOffsets > 1, the size of this array has to be calculated
- sizeof EQU 6
- ENDR
-
- ; Text Service Info List
- TextServiceInfo RECORD 0
- fComponent ds.l 1
- fItemName ds.l 64
- sizeof EQU 260
- ENDR
-
- TextServiceList RECORD 0
- fTextServiceCount ds.w 1 ; number of entries in the 'fServices' array
- fServices ds TextServiceInfo ; Note: array of 'TextServiceInfo' records follows
- sizeof EQU 262
- ENDR
-
- ScriptLanguageRecord RECORD 0
- fScript ds.w 1
- fLanguage ds.w 1
- sizeof EQU 4
- ENDR
-
- ScriptLanguageSupport RECORD 0
- fScriptLanguageCount ds.w 1 ; number of entries in the 'fScriptLanguageArray' array
- fScriptLanguageArray ds ScriptLanguageRecord ; Note: array of 'ScriptLanguageRecord' records follows
- sizeof EQU 6
- ENDR
-
-
- ; Low level routines which are dispatched directly to the Component Manager
- kCMGetScriptLangSupport EQU $0001 ; Component Manager call selector 1
- kCMInitiateTextService EQU $0002 ; Component Manager call selector 2
- kCMTerminateTextService EQU $0003 ; Component Manager call selector 3
- kCMActivateTextService EQU $0004 ; Component Manager call selector 4
- kCMDeactivateTextService EQU $0005 ; Component Manager call selector 5
- kCMTextServiceEvent EQU $0006 ; Component Manager call selector 6
- kCMGetTextServiceMenu EQU $0007 ; Component Manager call selector 7
- kCMTextServiceMenuSelect EQU $0008 ; Component Manager call selector 8
- kCMFixTextService EQU $0009 ; Component Manager call selector 9
- kCMSetTextServiceCursor EQU $000A ; Component Manager call selector 10
- kCMHidePaletteWindows EQU $000B ; Component Manager call selector 11
-
- ; High level TSM routines
- IF GENERATING68K THEN
- Macro
- _NewTSMDocument
- moveq #0,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT NewTSMDocument
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DeleteTSMDocument
- moveq #1,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT DeleteTSMDocument
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _ActivateTSMDocument
- moveq #2,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT ActivateTSMDocument
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DeactivateTSMDocument
- moveq #3,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT DeactivateTSMDocument
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _TSMEvent
- moveq #4,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT TSMEvent
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _TSMMenuSelect
- moveq #5,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT TSMMenuSelect
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetTSMCursor
- moveq #6,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT SetTSMCursor
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _FixTSMDocument
- moveq #7,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT FixTSMDocument
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetServiceList
- moveq #8,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT GetServiceList
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _OpenTextService
- moveq #9,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT OpenTextService
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _CloseTextService
- moveq #10,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT CloseTextService
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SendAEFromTSMComponent
- moveq #11,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT SendAEFromTSMComponent
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _InitTSMAwareApplication
- moveq #20,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT InitTSMAwareApplication
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _CloseTSMAwareApplication
- moveq #21,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT CloseTSMAwareApplication
- ENDIF
-
- ; Utilities
- IF GENERATING68K THEN
- Macro
- _SetDefaultInputMethod
- moveq #12,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT SetDefaultInputMethod
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetDefaultInputMethod
- moveq #13,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT GetDefaultInputMethod
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetTextServiceLanguage
- moveq #14,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT SetTextServiceLanguage
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetTextServiceLanguage
- moveq #15,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT GetTextServiceLanguage
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _UseInputWindow
- moveq #16,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT UseInputWindow
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _NewServiceWindow
- moveq #17,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT NewServiceWindow
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _CloseServiceWindow
- moveq #18,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT CloseServiceWindow
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetFrontServiceWindow
- moveq #19,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT GetFrontServiceWindow
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _FindServiceWindow
- moveq #23,d0
- dc.w $AA54
- EndM
- ELSE
- IMPORT FindServiceWindow
- ENDIF
-
- ; Low level TSM routines
- IF GENERATING68K THEN
- Macro
- _GetScriptLanguageSupport
- dc.w $2F3C
- dc.w $0004
- dc.w $0001
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT GetScriptLanguageSupport
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _InitiateTextService
- dc.w $2F3C
- dc.w $0000
- dc.w $0002
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT InitiateTextService
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _TerminateTextService
- dc.w $2F3C
- dc.w $0000
- dc.w $0003
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT TerminateTextService
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _ActivateTextService
- dc.w $2F3C
- dc.w $0000
- dc.w $0004
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT ActivateTextService
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DeactivateTextService
- dc.w $2F3C
- dc.w $0000
- dc.w $0005
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT DeactivateTextService
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _TextServiceEvent
- dc.w $2F3C
- dc.w $0006
- dc.w $0006
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT TextServiceEvent
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetTextServiceMenu
- dc.w $2F3C
- dc.w $0004
- dc.w $0007
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT GetTextServiceMenu
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _TextServiceMenuSelect
- dc.w $2F3C
- dc.w $0006
- dc.w $0008
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT TextServiceMenuSelect
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _FixTextService
- dc.w $2F3C
- dc.w $0000
- dc.w $0009
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT FixTextService
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetTextServiceCursor
- dc.w $2F3C
- dc.w $0004
- dc.w $000A
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT SetTextServiceCursor
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _HidePaletteWindows
- dc.w $2F3C
- dc.w $0000
- dc.w $000B
- moveq #0,d0
- dc.w $A82A
- EndM
- ELSE
- IMPORT HidePaletteWindows
- ENDIF
-
- ENDIF ; __TEXTSERVICES__
-